package cn.edu.zut.business;

import cn.edu.zut.DAO.StudentDao;
import cn.edu.zut.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 袁飞
 * @date 2019/4/9/00911:30
 */
@Service
public class CountPoint {
    @Autowired
    StudentDao studentDao;
    public void count(){
        List<Student> students=studentDao.queryAl();
        float sum=0;
        int i=0;
        float avg=0;
        for(Student s:students){
            sum=sum+s.getPoint();
            i++;
        }
        avg=sum/i;
        System.out.println(avg);
    }
    public void vvv(){
        System.out.println(1111);
    }
    @Autowired
    public void setStudentDao(StudentDao StudentDao) {
        this.studentDao = studentDao;
    }
}
